package com.theme.common.mvc.utils;

/**

 * */
public enum FileUploadParam {

    DEFAULT(0 ,"default","sky/default/",""),
    AVATAR_IMG(2,"avatar","sky/avatar/",""),
    GOODS_IMG(1,"goods","sky/goods/",""),
    THEME(3,"theme","theme/",""),
    THEME_ZIP(4,"themezip","themezip/",""),
    WIDGE(5,"widge","widge/",""),
    ;

    private int type;
    private String sourceDir;//图片 音频 视频资源上传地址
    private String webUrl;//图片 音频 视频资源查看地址
    private String fileName;//图片 音频 视频资源上传地址

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getSourceDir() {
        return sourceDir;
    }

    public FileUploadParam setSourceDir(String sourceDir) {
        this.sourceDir = sourceDir;
        return this;
    }

    public String getWebUrl() {
        return webUrl;
    }

    public FileUploadParam setWebUrl(String webUrl) {
        this.webUrl = webUrl;
        return this;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public static FileUploadParam getByType(int type){
        for (FileUploadParam fileUploadParam: values()) {
            if (fileUploadParam.type == type) {
                return fileUploadParam;
            }
        }
        return null;
    }
    FileUploadParam(int type, String sourceDir, String webUrl,String fileName) {
        this.type = type;
        this.sourceDir = sourceDir;
        this.webUrl = webUrl;
        this.fileName = fileName;
    }

}
